package com.mach.platform.domain.iot;

import lombok.Data;

import java.io.Serializable;
import java.math.BigInteger;

@Data
public class IotCollItemData implements Serializable {
	private static final long serialVersionUID = 1L;

	private Long id;

	private int dataLen;

	private int isGet;

	private String name;

	private String unit;

	/**
	 * 属性类别，100 数据，101 开关，103 其他，诸如此类
	 */
	private Integer propertyType;

	private BigInteger valueAddr;

	private Object value;

	private double warnDown;

	private double warnUp;

	public IotCollItemData(String name,String unit) {
		this.name = name;
		this.unit = unit;
	}

	/**
	 * 真实设备构造方法
	 * @param item
	 */
	public IotCollItemData(IotCollItem item) {
		this.id = item.getId();
		this.dataLen = item.getDataLen();
		this.isGet = item.getIsGet();
		this.name = item.getName();
		this.unit = item.getUnit();
		this.propertyType = item.getPropertyType();
		this.valueAddr = item.getValueAddr();
		this.warnDown = item.getWarnDown();
		this.warnUp = item.getWarnUp();
	}

	/**
	 * 虚拟设备构造方法
	 * @param item
	 */
	public IotCollItemData(IotVirtualItem item) {
		this.id = item.getId();
		this.isGet = item.getIsGet();
		this.name = item.getName();
		this.unit = item.getUnit();
		this.propertyType = item.getPropertyType();
	}

}
